import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

export default new Router({
  linkActiveClass: "is-active",
  routes: [{
      path: '*',
      redirect: '/home',
    }, {
      path: '/',
      redirect: {
        name: 'index'
      }
    },
    {
      path: '/index',
      name: 'index',
      component: resolve => require(['@/view/index'], resolve),
      redirect: '/home',
      children: [{
          path: '/home',
          name: 'home',
          component: resolve => require(['@/view/home'], resolve),
        },
        {
          path: '/password',
          name: 'password',
          component: resolve => require(['@/view/forgetPasswd'], resolve),
        },
        {
          path: '/search',
          name: 'search',
          component: resolve => require(['@/view/search/index'], resolve),
        },
        {
          path: '/bookshelf',
          name: 'bookshelf',
          component: resolve => require(['@/view/bookshelf'], resolve)
        },
        {
          path: '/events',
          name: 'events',
          redirect: '/events/eventsIndex',
          component: resolve => require(['@/view/events/index'], resolve),
          children: [{
              path: '/events/eventsIndex',
              name: 'eventsIndex',
              component: resolve => require(['@/view/events/events'], resolve),
            },
            {
              path: '/events/eventsContent',
              name: 'eventsContent',
              component: resolve => require(['@/view/events/events_content'], resolve),
            }
          ]
        },
        {
          path: '/personal',
          name: 'personal',
          redirect: '/personal/personalIndex',
          component: resolve => require(['@/view/personal_center/index'], resolve),
          children: [{
              path: '/personal/personalIndex',
              name: 'personalIndex',
              component: resolve => require(['@/view/personal_center/personal_center'], resolve),
              redirect: '/mycollec',
              children: [{
                  path: '/mycollec',
                  name: 'mycollec',
                  component: resolve => require(['@/view/personal_center/my_collec'], resolve),
                },
                {
                  path: '/myrecord',
                  name: 'myrecord',
                  component: resolve => require(['@/view/personal_center/my_record'], resolve),
                },
                {
                  path: '/mymessage',
                  name: 'mymessage',
                  component: resolve => require(['@/view/personal_center/my_message'], resolve),
                },        
                {
                  path: '/myshare',
                  name: 'myshare',
                  component: resolve => require(['@/view/personal_center/my_share'], resolve),
                },
                {
                  path: '/myset',
                  name: 'myset',
                  component: resolve => require(['@/view/personal_center/my_set'], resolve),
                }
              ]
            }

          ]
        },
        {
          path: '/message_content',
          name: 'message_content',
          component: resolve => require(['@/view/personal_center/message_content'], resolve),
        },
        {
          path: '/all',
          name: 'all',
          redirect: '/all/book',
          component: resolve => require(['@/view/all/index'], resolve),
          children: [{
              path: '/all/book',
              name: 'allBook',
              component: resolve => require(['@/view/all/book'], resolve),
            },
            {
              path: '/all/periodical',
              name: 'allPeriodical',
              component: resolve => require(['@/view/all/periodical'], resolve),
            },
            {
              path: '/all/newspaper',
              name: 'allNewspaper',
              component: resolve => require(['@/view/all/newspaper'], resolve),
            },
            {
              path: '/all/video_music',
              name: 'allVideo_music',
              component: resolve => require(['@/view/all/video_music'], resolve),
            },
            {
              path: '/all/read',
              name: 'allRead',
              component: resolve => require(['@/view/all/read'], resolve),
            }
          ]
        },
        {
          path: '/ranklist',
          name: 'ranklist',
          redirect: "/ranklist/all_rank",
          component: resolve => require(['@/view/rank_list'], resolve),
          children: [{
              path: '/ranklist/all_rank',
              name: 'all_rank',
              component: resolve => require(['@/view/rank_list/all_rank'], resolve),
            },
            {
              path: '/ranklist/every_rank',
              name: 'every_rank',
              component: resolve => require(['@/view/rank_list/every_rank'], resolve),
            },
            {
              path: '/ranklist/good_rank',
              name: 'good_rank',
              component: resolve => require(['@/view/rank_list/good_rank'], resolve),
            },
            {
              path: '/ranklist/collection_rank',
              name: 'collection_rank',
              component: resolve => require(['@/view/rank_list/collection_rank'], resolve),
            }
          ]
        },
        {
          path: '/book',
          name: 'book',
          redirect: "/book/all",
          component: resolve => require(['@/view/book/index'], resolve),
          children: [{
              path: '/book/all',
              name: 'bookall',
              component: resolve => require(['@/view/book/all'], resolve),
            },
            {
              path: '/book/type/:id',
              name: 'booktype',
              component: resolve => require(['@/view/book/type'], resolve),
            },
            {
              path: '/book/info',
              name: 'bookinfo',
              component: resolve => require(['@/view/book/info'], resolve),
            },
            {
              path: '/book/content',
              name: 'bookcontent',
              component: resolve => require(['@/view/book/content'], resolve),
            },
            {
              path: '/book/pdf',
              name: 'bookpdf',
              component: resolve => require(['@/view/book/pdf'], resolve),
            },
          ]
        },
        {
          path: '/periodical',
          name: 'periodical',
          redirect: "/periodical/all",
          component: resolve => require(['@/view/periodical/index'], resolve),
          children: [{
              path: '/periodical/all',
              name: 'periodicalall',
              component: resolve => require(['@/view/periodical/all'], resolve),
            },
            {
              path: '/periodical/type/:id',
              name: 'periodicaltype',
              component: resolve => require(['@/view/periodical/type'], resolve),
            },
            {
              path: '/periodical/info',
              name: 'periodicalinfo',
              component: resolve => require(['@/view/periodical/info'], resolve),
            },
            {
              path: '/periodical/list',
              name: 'periodicallist',
              component: resolve => require(['@/view/periodical/list'], resolve),
            },
            {
              path: '/periodical/content',
              name: 'periodicalcontent',
              component: resolve => require(['@/view/periodical/content'], resolve),
            },
          ]
        },
        {
          path: '/newspaper',
          name: 'newspaper',
          redirect: "/newspaper/all",
          component: resolve => require(['@/view/newspaper/index'], resolve),
          children: [{
              path: '/newspaper/all',
              name: 'newspaperall',
              component: resolve => require(['@/view/newspaper/all'], resolve),
            },
            {
              path: '/newspaper/info',
              name: 'newspaperinfo',
              component: resolve => require(['@/view/newspaper/info'], resolve),
            },
            {
              path: '/newspaper/list',
              name: 'newspaperlist',
              component: resolve => require(['@/view/newspaper/list'], resolve),
            },
            {
              path: '/newspaper/content',
              name: 'newspapercontent',
              component: resolve => require(['@/view/newspaper/content'], resolve),
            },
          ]
        },
        {
          path: '/read',
          name: 'read',
          redirect: "/read/all",
          component: resolve => require(['@/view/read/index'], resolve),
          children: [{
              path: '/read/all',
              name: 'readall',
              component: resolve => require(['@/view/read/all'], resolve),
            },
            {
              path: '/read/content',
              name: 'readcontent',
              component: resolve => require(['@/view/read/content'], resolve),
            },
            {
              path: '/read/share_content',
              name: 'share_content',
              component: resolve => require(['@/view/read/share_content'], resolve),
            },
          ]
        },
        {
          path: '/videomusic',
          name: 'videomusic',
          redirect: "/videomusic/all",
          component: resolve => require(['@/view/videomusic/index'], resolve),
          children: [{
              path: '/videomusic/all',
              name: 'videomusicall',
              component: resolve => require(['@/view/videomusic/all'], resolve),
            },
            {
              path: '/videomusic/video',
              name: 'videomusicvideo',
              component: resolve => require(['@/view/videomusic/video'], resolve),
            },
            {
              path: '/videomusic/music',
              name: 'videomusicmusic',
              component: resolve => require(['@/view/videomusic/music'], resolve),
            },
            {
              path: '/videomusic/music_content',
              name: 'videomusicmusic_content',
              component: resolve => require(['@/view/videomusic/music_content'], resolve),
            },
            {
              path: '/videomusic/video_nocontent',
              name: 'videomusicvideo_nocontent',
              component: resolve => require(['@/view/videomusic/video_nocontent'], resolve),
            },
            {
              path: '/videomusic/video_content',
              name: 'videomusicvideo_content',
              component: resolve => require(['@/view/videomusic/video_content'], resolve),
            },
            {
              path: '/record_videocontent',
              name: 'record_videocontent',
              component: resolve => require(['@/view/videomusic/record_videocontent'], resolve),
            },
          ]
        }
      ]
    },
  ]
})
